import 'package:flutter/material.dart';

void main() => runApp(HomePage());

class HomePage extends StatelessWidget {
  final List<String> _items = List.generate(20, (index) => "item$index");

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("dismissable"),
        ),
        body: ListView.builder(
            itemCount: _items.length,
            itemBuilder: (context, index) {
              final item = _items[index];
              return Dismissible(
                background: Container(
                  color: Colors.red,
                ),
                key: Key(item),
                onDismissed: (i){
                  _items.removeAt(index);
                },
                movementDuration: Duration(milliseconds: 100),
                child: ListTile(
                  title: Text("aa$item"),
                  leading: Icon(Icons.star),
                ),
              );
            }),
      ),
    );
  }
}
